-
Notifications
You must be signed in to change notification settings - Fork 1
Prevent request to pay being clicked twice #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures the “Request to Pay” button only appears once per bill and displays the payment address after a request has been made.
- Introduces the
paymentStatus
SDK call and fetchesrequestedToPay
/paymentAddress
. - Adds conditional rendering of the pay button and payment address row.
- Propagates
requestedToPay
intoQuoteActions
and updates toast IDs.
Comments suppressed due to low confidence (3)
src/pages/quotes/QuotePage.tsx:483
- Update the title/description to refer to “pay” instead of “mint” for consistency with the button text and new feature.
title="Confirm requesting to mint"
src/pages/quotes/QuotePage.tsx:440
- Include the error message (e.g.,
+ ": " + error.message
) to aid debugging when the mutation fails.
<span>
src/pages/quotes/QuotePage.tsx:744
- Add tests to cover the new behavior: button hidden when
requestedToPay
is true and payment address displayed.
{requestedToPay ? (
enabled: shouldFetchKeyset, | ||
}) | ||
|
||
const { data: paymentData } = useQuery({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an enabled: !!billId
flag to this query to avoid unnecessary network requests when billId
is empty.
Copilot uses AI. Check for mistakes.
PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
|
||
{value.status === "Accepted" && "keyset_id" in value && !ebillPaid && !newKeyset ? ( | ||
{value.status === "Accepted" && "keyset_id" in value && !ebillPaid && !newKeyset && !requestedToPay ? ( | ||
<ConfirmDrawer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit confusing that this button and the confirmation vary between "request to pay" and "request to mint" 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll adjust for consistency
Deploying wildcat-dashboard with
|
Latest commit: |
32307b7
|
Status: | ✅ Deploy successful! |
Preview URL: | https://f5b524d9.wildcat-dashboard.pages.dev |
Branch Preview URL: | https://stefan-requestpay.wildcat-dashboard.pages.dev |
User description
📝 Description
Checks whether request to pay has been initiated, and only display the request to pay button if not, otherwise display the address.
Closes #55
Requires payment status to be exposed and merged in Wildcat
✅ Checklist
Please ensure the following tasks are completed before requesting a review:
npm run lint
or the equivalent linting command.PR Type
Enhancement
Description
Prevent duplicate request-to-pay clicks by checking payment status
Display payment address when request has been initiated
Add payment status API integration and types
Update UI to conditionally show request button or address
Changes diagram
Changes walkthrough 📝
sdk.gen.ts
Add payment status API endpoint
src/generated/client/sdk.gen.ts
BillPaymentData
andBillPaymentState
type importspaymentStatus
API function for checking payment statustypes.gen.ts
Add payment status type definitions
src/generated/client/types.gen.ts
BillWaitingForPaymentState
type with payment detailsBillPaymentStatus
type with request status flagsBillPaymentState
andBillPaymentData
types for APIQuotePage.tsx
Implement payment status checking and UI updates
src/pages/quotes/QuotePage.tsx
paymentStatus
API functionrequestedToPay
prop toQuoteActions
component